import java.io.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Stack;
import java.util.Random;
import java.lang.Math;
import java.lang.String;

class Tester{
	
	static double roundPot;
	
	public static void main(String args[]) throws IOException{
		GameRunner gr = new GameRunner();
		while(true)
		{
			gr.run();
		}
		
		
		/*
		// start
		
		// open up standard input
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s;
		System.out.println("Let the games begin" + "\n");
		
		System.out.println("What is your name");
		s = br.readLine();
		Player user = new Player(s);
		
		boolean quit = false;
		boolean quitRound = false;
		int opponents = 0;
		int resp;
		int resp2;
		double currBet;
		Card burn;
		double smallBlind = 10.00;
		double bigBlind = 15.00;
		while (!quit){
			System.out.println("How many opponents would you like to have at your table");
			s = br.readLine();
			opponents = Integer.parseInt(s);
			Player[] players = new Player[opponents+1];
		
			players[0] = user;
			// initialize opponents
			for ( int i = 1; i < opponents+1; i++){
				players[i] = new Player("Player" + i);
			}
			
		
			// play out rounds
			int ptrToDealer = 1; // points to dealer
			double b = 0;
			roundPot = 0;
			quitRound = false;
			int dealingPtr = 0;
			int bettingPtr = 0;
			Card[] ftr;    // for holding flop, turn and river
			while( !quitRound ){
				ftr = new Card[5];
				roundPot = 0;
				Deck d = new Deck();
				d.shuffleDeck();
				int ptrToCurr = ptrToDealer;	// points to current player
				
				System.out.println("Dealer is:" + players[ptrToDealer].getName());
				
				
				// small blind
				ptrToCurr = getNextPlayer(ptrToCurr, opponents);
				if ( ptrToCurr == 0 ){ 	// if it is the user
					System.out.println("The Small blind is " + smallBlind + " would you like to enter (1), or fold now(2).");
					s = br.readLine();
					b = (double)Integer.parseInt(s);
					if ( b == 1 ){
						players[0].placeBet(smallBlind);
						roundPot = roundPot + players[0].getBet();
						currBet = players[0].getBet();
					}
					else{
						players[0].fold();
						System.out.println("You choose not enter this round");
						// find an ai that can do hte small blind isntead of hte user
						// 		we are guaranteed to have at least 3 people
						while( players[ptrToCurr].getMoney() < smallBlind){
							ptrToCurr = getNextPlayer(ptrToCurr, opponents);
						}
						players[ptrToCurr].placeBet(smallBlind);
						roundPot = roundPot + players[ptrToCurr].getBet();
						currBet = players[ptrToCurr].getBet();
					}	
					
					System.out.println("Player: " + players[ptrToCurr].getName() + " just put " + players[0].getBet() + " for Small Blind");
				}	
				else {		// if it is an AI
					while( players[ptrToCurr].getMoney() < smallBlind){
						ptrToCurr = getNextPlayer(ptrToCurr, opponents);
					}
					players[ptrToCurr].placeBet( smallBlind );	// for now bets qrtr of his money
					roundPot = roundPot + players[ptrToCurr].getBet();
					currBet = players[ptrToCurr].getBet();
					System.out.println("Player: " + players[ptrToCurr].getName() + " just put " + players[ptrToCurr].getBet() + " for Small Blind");
				}
				
				
				// big blind 
				int foldOrBet = 0;
				ptrToCurr = getNextPlayer(ptrToCurr, opponents);
				// if it is the user
				if ( ptrToCurr == 0 ){ 	// if it is the user
					System.out.println("The Big blind is " + bigBlind + " would you like to enter (1), or fold now(2).");
					s = br.readLine();
					b = (double)Integer.parseInt(s);
					if ( b == 1 ){
						players[0].placeBet(bigBlind);
						roundPot = roundPot + players[0].getBet();
						currBet = players[0].getBet();
					}
					else{
						players[0].fold();
						System.out.println("You choose not enter this round");
						// find an ai that can do hte small blind isntead of hte user
						// 		we are guaranteed to have at least 3 people
						while( players[ptrToCurr].getMoney() < bigBlind){
							ptrToCurr = getNextPlayer(ptrToCurr, opponents);
						}
						players[ptrToCurr].placeBet(bigBlind);
						roundPot = roundPot + players[ptrToCurr].getBet();
						currBet = players[ptrToCurr].getBet();
					}	
					
					System.out.println("Player: " + players[ptrToCurr].getName() + " just put " + players[0].getBet() + " for Big Blind");
				}	
				else {		// if it is an AI
					while( players[ptrToCurr].getMoney() < bigBlind){
						ptrToCurr = getNextPlayer(ptrToCurr, opponents);
					}
					players[ptrToCurr].placeBet( bigBlind );	// for now bets qrtr of his money
					roundPot = roundPot + players[ptrToCurr].getBet();
					currBet = players[ptrToCurr].getBet();
					System.out.println("Player: " + players[ptrToCurr].getName() + " just put " + players[ptrToCurr].getBet() + " for Big Blind");
				}
				
			
				
				// all player are dealt two cards face down
				dealingPtr = getNextPlayer(ptrToDealer, opponents);   // start to left of the dealer
				// first to the left of the dealer who hasnt folded
				while(players[dealingPtr].getHasFolded())
					dealingPtr = getNextPlayer(ptrToDealer, opponents);
				bettingPtr = dealingPtr;
				int twice = 0;
				while ( twice != 2){
					// give cards only to those who havent folded
					if(!players[dealingPtr].getHasFolded()){
						players[dealingPtr].receiveCard(d.getNextCard());
						dealingPtr = getNextPlayer(dealingPtr, opponents);
					}
					else
						dealingPtr = getNextPlayer(dealingPtr, opponents);
					if( dealingPtr == ptrToDealer )
						twice++;
					if( twice == 2 && !players[dealingPtr].getHasFolded()){
						players[dealingPtr].receiveCard(d.getNextCard());
					}
				}
				System.out.println(" \nAll Players have been dealt 2 cards");
				if(!players[0].getHasFolded()){
					System.out.println("    Your cards are: ");
					System.out.println("       " + players[0].getHand().viewCard(0));
					System.out.println("       " + players[0].getHand().viewCard(1));
				}
				
				
				/////////////////////////////////////////////
				// round of betting goes here 
				System.out.println("\nround of betting begins here");
				ptrToCurr = getNextPlayer(ptrToCurr, opponents);
				currBet = roundOfBetting(players, currBet, opponents, ptrToCurr);
				//////////////////////////////////////////////
				
				
				
				// flop is placed on the table
				burn = d.getNextCard();
				ftr[0] = d.getNextCard();
				ftr[1] = d.getNextCard();
				ftr[2] = d.getNextCard();
				System.out.println("\n flop is   " + ftr[0].getNumber() + " of " + ftr[0].getSuit() + "   " + ftr[1].getNumber() + " of " + ftr[1].getSuit()+ "   " + ftr[2].getNumber()+ " of " + ftr[2].getSuit());
				
				
				/////////////////////////////////////////////
				// round of betting goes here 
				System.out.println("\nround of betting begins here");
				currBet = roundOfBetting(players, currBet, opponents, ptrToCurr);
				//////////////////////////////////////////////
				
				
				
				// turn is placed on table
				burn = d.getNextCard();
				ftr[3] = d.getNextCard();
				System.out.println("\nturn is placed on the table");
				System.out.println("     turn is: " + ftr[3].getNumber() + " of " + ftr[3].getSuit());
				
				
				/////////////////////////////////////////////
				// round of betting goes here 
				System.out.println("\nround of betting begins here");
				currBet = roundOfBetting(players, currBet, opponents, ptrToCurr);
				//////////////////////////////////////////////
				
			
				
				// river is placed on table
				burn = d.getNextCard();
				ftr[4] = d.getNextCard();
				System.out.println("\nriver is placedo on the table");
				System.out.println("     river is: " + ftr[4].getNumber() + " of " + ftr[4].getSuit());
				
				
				/////////////////////////////////////////////
				// round of betting goes here 
				System.out.println("\nround of betting begins here");
				currBet = roundOfBetting(players, currBet, opponents, ptrToCurr);
				//////////////////////////////////////////////
				
			
				
				///////////////////////////////////
				// everyone turns their cards face up
				System.out.println("\neveryone reveals their cards here");
				/////////////////////////////////////
				
				
				/////////////////////////////////////////////////////
				// winner is declared and given pots money
				System.out.println("\nWinner is declared here");
				roundPot = 0;
				///////////////////////////////////////////////////////////
				
				
				// point to next person who will deal next round
				ptrToDealer = getNextPlayer(ptrToDealer, opponents);
				
				
				// reset all folders AND make sure there are at least three players who can remain in the game
				int remainingPlayers = 0;
				for(int resetter=0; resetter < opponents+1; resetter++){
					players[resetter].setFolded(false);
					players[resetter].setHasBet(false);
					if(players[resetter].getMoney() > bigBlind){
						remainingPlayers++;
					}
				}
				if ( remainingPlayers < 4){
					System.out.println("There are not enough players left at the table");
					quitRound = true;
				}
				
				// if you run out of money
				if(!(players[0].getMoney() > 0)){
					System.out.println("You have gone bankrupt, you lose");
					quitRound = true;
					quit = true;
				}
				
				// if you still have money ask about next round
				else{
					// another round prompt	
					System.out.println("Would you like to quit this game? \n (1) = no/another round (2) = yes/quit");
					s = br.readLine();
					resp = Integer.parseInt(s);
					if (resp == 2)
						quitRound = true;
				}
			}
		
			// in case bankrupt you just quit, otherwise ask
			if(!quit){
				System.out.println("Would you like to remain at this table and start a new game? \n (1) = yes (2) = no/quit");
				s = br.readLine();
				resp2 = Integer.parseInt(s);
				if (resp2 == 2)
					quit = true;
			}
		}
		
		System.out.println("\n Complete");
		*/
	}
	
	
}